package com.tl.ip_location_relation_v4.utils;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class FileInputUtilV1 {
	/**
	 * 
	 * @author Antg
	 * @date 2021年7月6日
	 * @param
	 * @retun
	 * @Description 按行读取文件保存在一个list中 V1版本
	 */
	public static List<String> loadData(String filePath, String charSet) {
		try {
			FileInputStream fis = new FileInputStream(filePath);
			InputStreamReader isr = new InputStreamReader(fis, charSet);
			BufferedReader br = new BufferedReader(isr);
			List<String> resultList = new ArrayList<String>();
			String buffer = "";
			while ((buffer = br.readLine()) != null) {
				resultList.add(buffer);
			}
			br.close();
			return resultList;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
